var fs = require('fs');
var url = require('url');

function showimg(request, response) {
    
    var query = url.parse(request.url, true).query;
    var imgurl = query.src;

    fs.readFile('./img/' + imgurl, 'binary', function(err, file) {

        if(err) {
            throw err;
        }

        response.writeHead(200, {'content-type': 'image/png'});
        response.write(file, 'binary');
        response.end();

    });

}

exports.showimg = showimg;